package com.xjscrm.common.enums;


import com.xjscrm.common.constant.CacheKey;

/**
 * @author jianghan
 * @date 2019-04-03 14:18
 */
public enum SmsType {
    REGISTER(1, CacheKey.REGISTER_SMS_CODE,"SMS_202440032"),
    LOGIN(2, CacheKey.LOGIN_SMS_CODE,"SMS_202440034"),
    PASSWORD(3,CacheKey.CHANGE_PWD_SMS_CODE,"SMS_202440031"),
    AUTHINFO(4,CacheKey.AUTH_INFO_SMS_CODE,"SMS_202440035");
    private Integer value;
    private String desc;
    private String tempId;
    SmsType(Integer value, String desc, String tempId) {
        this.value = value;
        this.desc = desc;
        this.tempId = tempId;
    }
    public Integer getValue() {
        return value;
    }
    public String getDesc() {
        return desc;
    }
    public String getTempId(){
        return tempId;
    }
    public static SmsType getValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (SmsType userType: SmsType.values()) {
            if (userType.getValue() == value) {
                return userType;
            }
        }
        return null;
    }
    public static String getDesc(Integer value) {
        if(getValue(value) == null){
            return null;
        }
        return getValue(value).getDesc();
    }
}
